package site.yunnong.atvris.service.impl;

import org.springframework.stereotype.Service;
import site.yunnong.atvris.dao.domain.Banner;
import site.yunnong.atvris.dao.domain.BannerExample;
import site.yunnong.atvris.dao.mapper.BannerMapper;
import site.yunnong.atvris.service.BannerService;
import site.yunnong.atvris.common.enumeration.BannerStatusEnum;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zjh
 * @date 2021/9/4 23:26
 */
@Service
public class BannerServiceImpl implements BannerService {
    @Resource
    private BannerMapper bannerMapper;
    @Override
    public int insertSelective(Banner banner) {
        return bannerMapper.insertSelective(banner);
    }

    @Override
    public List<Banner> selectAllEffective() {
        BannerExample example = new BannerExample();
        example.createCriteria().andStatusEqualTo(BannerStatusEnum.ACTIVE.getValue());
        return bannerMapper.selectByExample(example);
    }
}
